package com.ruoyi.project.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.system.mapper.ContentAttachmentMapper;
import com.ruoyi.project.system.domain.ContentAttachment;
import com.ruoyi.project.system.service.IContentAttachmentService;

/**
 * 内容附件Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-20
 */
@Service
public class ContentAttachmentServiceImpl implements IContentAttachmentService 
{
    @Autowired
    private ContentAttachmentMapper contentAttachmentMapper;

    /**
     * 查询内容附件
     * 
     * @param id 内容附件主键
     * @return 内容附件
     */
    @Override
    public ContentAttachment selectContentAttachmentById(Long id)
    {
        return contentAttachmentMapper.selectContentAttachmentById(id);
    }

    /**
     * 查询内容附件列表
     * 
     * @param contentAttachment 内容附件
     * @return 内容附件
     */
    @Override
    public List<ContentAttachment> selectContentAttachmentList(ContentAttachment contentAttachment)
    {
        return contentAttachmentMapper.selectContentAttachmentList(contentAttachment);
    }

    /**
     * 新增内容附件
     * 
     * @param contentAttachment 内容附件
     * @return 结果
     */
    @Override
    public int insertContentAttachment(ContentAttachment contentAttachment)
    {
        contentAttachment.setCreateTime(DateUtils.getNowDate());
        return contentAttachmentMapper.insertContentAttachment(contentAttachment);
    }

    /**
     * 修改内容附件
     * 
     * @param contentAttachment 内容附件
     * @return 结果
     */
    @Override
    public int updateContentAttachment(ContentAttachment contentAttachment)
    {
        return contentAttachmentMapper.updateContentAttachment(contentAttachment);
    }

    /**
     * 批量删除内容附件
     * 
     * @param ids 需要删除的内容附件主键
     * @return 结果
     */
    @Override
    public int deleteContentAttachmentByIds(Long[] ids)
    {
        return contentAttachmentMapper.deleteContentAttachmentByIds(ids);
    }

    /**
     * 删除内容附件信息
     * 
     * @param id 内容附件主键
     * @return 结果
     */
    @Override
    public int deleteContentAttachmentById(Long id)
    {
        return contentAttachmentMapper.deleteContentAttachmentById(id);
    }
}
